package com.org.entity.job;

import com.org.entity.base.BaseEntity;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.Date;

@Data
@Table(name = "JOB_TASK")
public class JobTask extends BaseEntity {

    /**
     * 任务编码
     */
    @Column(name = "CODE")
    @Length(min = 0,max = 64,message = "编码不能超过64")
    @NotBlank(message = "任务编码不能为空！")
    private String code;

    /**
     * 任务名称
     */
    @Column(name = "NAME")
    @NotBlank(message = "任务名称不能为空！")
    private String name;

    /**
     * 调用类名称
     */
    @Column(name = "CLAZZ_NAME")
    @NotBlank(message = "触发类不能为空！")
    private String clazzName;

    /**
     * CRON规则编码
     */
    @Column(name = "FK_CRON_CODE")
    @NotBlank(message = "频率(Cron)不能为空！")
    private String fkCronCode;

    /**
     * cron 表达式
     */
    @Transient
    private String fkCronExpression;

    /**
     * 状态：0停止；1启用
     */
    @Column(name = "STATE")
    private int state;

    /**
     * 说明
     */
    @Column(name = "DESCR")
    private String descr;

    /**
     * 添加时间
     */
    @Column(name = "ADD_TIME")
    private Date addTime;

    /**
     * 添加用户
     */
    @Column(name = "ADD_USER_ID")
    private String addUserId;

    /**
     * cron 名称
     */
    @Transient
    private String fkCronName;

}



